﻿using System.Linq;

namespace Core.Data
{
    public partial interface IRepository<T> where T : BaseEntity
    {
        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        T GetById(object id);

        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entity"></param>
        void Insert(T entity);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="entity"></param>
        void Update(T entity);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity"></param>
        void Delete(T entity);

        /// <summary>
        /// 查询
        /// </summary>
        IQueryable<T> Table { get; }

        /// <summary>
        /// 查询
        /// </summary>
        IQueryable<T> TableNoTracking { get; }

    }
}
